var factory = sy.getModule('myApp',['infinite-scroll']);
	// 创建后台数据交互工厂（分页）
	factory.factory('store', function ($http) {
	    var Demo = function () {
	        this.items = {};
	    };
	        
        Demo.prototype.query = function (id) {
        	this.items={};
            sy.openLoad();
	        $http.post('/m/store/detail',{
				id:id
			}).success(function (data) {
				sy.closeLoad();
				if(data){
					this.items = data;
					initMap(data.lng,data.lat);
				}
	        }.bind(this)).error(function(data, status) {
	        	sy.closeLoad();
			});
        };
	    return Demo;
	});
	
	
	// 申明页面控制类、
	factory.controller('mapController',['$http','$scope','store',
	   	function ($http,$scope, store) {
		     $scope.store = new store();
		     $scope.store.query(_id);
		}
	]);
	var marker,map;
	function initMap(lng,lat){
		 marker,map = new AMap.Map('container', {
		        resizeEnable: true,
		        zoom:11,
		        center: [lng, lat]
		        
		    });
		 addMarker(lng,lat);
	}
	
	function addMarker(lng,lat) {
        if (marker) {
            return;
        }
        marker = new AMap.Marker({
            icon: "http://webapi.amap.com/theme/v1.3/markers/n/mark_b.png",
            position: [lng, lat]
        });
        marker.setMap(map);
    }